home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / QuickTime / Programming Stuff / Sample Code / Movie Toolbox / Inside Mac Movie Toolbox Code / mtb14.c < prev    next >
Encoding:
Text File  |  1994-12-05  |  1.4 KB  |  70 lines  |  [TEXT/MPS ]

  1. /*
  2.   File:            mtb14.c
  3.   Contains:        Cover Proc Functions
  4.   Written by:    DTS and QT Engineering
  5.   Copyright:    © 1992-1994 by Apple Computer, Inc., all rights reserved.
  6.   Change History (most recent first):
  7.   <1>         12/4/94    khs        changed the format of the file to the new look and feel
  8.   To Do:
  9. */
  10.  
  11.  
  12. // INCLUDES
  13. #include "mtb.h"
  14.  
  15.  
  16. // FUNCTIONS
  17. pascal OSErr MyCoverProc(Movie aMovie,
  18.                          RgnHandle changedRgn,
  19.                          long refcon)
  20. {
  21.     CGrafPtr mPort;
  22.     GDHandle mGD;
  23.  
  24.     GetMovieGWorld(aMovie, &mPort, &mGD);
  25.     DiffRgn(mPort->clipRgn, changedRgn, mPort->clipRgn);
  26.     return noErr;
  27. }
  28.  
  29.  
  30. pascal OSErr MyUnCoverProc(Movie aMovie,
  31.                            RgnHandle changedRgn,
  32.                            long refcon)
  33. {
  34.     CGrafPtr mPort,  curPort;
  35.     GDHandle mGD,  curGD;
  36.  
  37.     GetMovieGWorld(aMovie, &mPort, &mGD);
  38.     GetGWorld(&curPort, &curGD);
  39.     SetGWorld(mPort, mGD);
  40.  
  41.     InvalRgn(changedRgn);
  42.     UnionRgn(mPort->clipRgn, changedRgn, mPort->clipRgn);
  43.  
  44.     SetGWorld(curPort, curGD);
  45.     return noErr;
  46. }
  47.  
  48.  
  49.     void InitCoverProcs(WindowPtr aWindow,
  50.                         Movie aMovie)
  51.     {
  52.         RgnHandle displayBounds;
  53.         GrafPtr curPort;
  54.  
  55.         displayBounds = GetMovieDisplayBoundsRgn(aMovie);
  56.         if (displayBounds == nil)
  57.             return;
  58.  
  59.         GetPort(&curPort);
  60.         SetPort(aWindow);
  61.         ClipRect(&aWindow->portRect);
  62.         DiffRgn(aWindow->clipRgn, displayBounds, aWindow->clipRgn);
  63.         DisposeRgn(displayBounds);
  64.         SetPort(curPort);
  65.  
  66.         SetMovieCoverProcs(aMovie, &MyUnCoverProc, &MyCoverProc, 0);
  67.     }
  68.  
  69.  
  70.